/**
 * 岗位接口
 */

const Router = require("koa-router");
const auth = require("../middleware/auth");
const router = new Router();
const { SystemDictDataController } = require("../controller/sys_dict_data.js");
const passport = require("koa-passport");

router.get(
  "/v1/system/dictData/list",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:query"),
  SystemDictDataController.sysDictDataList
);

router.post(
  "/v1/system/dictData/add",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:add"),
  SystemDictDataController.sysDictDataAdd
);
router.post(
  "/v1/system/dictData/delete",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:remove"),
  SystemDictDataController.sysDictDataDel
);
router.post(
  "/v1/system/dictData/deleteByIds",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:remove"),
  SystemDictDataController.sysDictDataDelByIds
);
router.put(
  "/v1/system/dictData/update",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:edit"),
  SystemDictDataController.sysDictDataUpd
);

router.get(
  "/v1/system/dictData/all",
  SystemDictDataController.sysAllDictDataList
);
router.get(
  "/v1/system/dictData/getByDictCode",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:query"),
  SystemDictDataController.sysDictDataByDictCode
);

// dict_type 查询数据
router.get(
  "/v1/system/dictData/type",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:query"),
  SystemDictDataController.sysDictDataByDictType
);

router.post(
  "/v1/system/dictData/export",
  passport.authenticate("jwt", { session: false }),
  auth("system:dict:query"),
  SystemDictDataController.sysDictDataExport
);
module.exports = router;
